3.439 \(\int \cos (c+d x) (a+b \tan ^2(c+d x))^2 \, dx\)

Optimal. Leaf size=62 \[ \frac {(a-b)^2 \sin (c+d x)}{d}+\frac {b (4 a-3 b) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b^2 \tan (c+d x) \sec (c+d x)}{2 d} \]

[Out]

1/2*(4*a-3*b)*b*arctanh(sin(d*x+c))/d+(a-b)^2*sin(d*x+c)/d+1/2*b^2*sec(d*x+c)*tan(d*x+c)/d

________________________________________________________________________________________

Rubi [A]  time = 0.09, antiderivative size = 62, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {3676, 390, 385, 206} \[ \frac {(a-b)^2 \sin (c+d x)}{d}+\frac {b (4 a-3 b) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b^2 \tan (c+d x) \sec (c+d x)}{2 d} \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]*(a + b*Tan[c + d*x]^2)^2,x]

[Out]

((4*a - 3*b)*b*ArcTanh[Sin[c + d*x]])/(2*d) + ((a - b)^2*Sin[c + d*x])/d + (b^2*Sec[c + d*x]*Tan[c + d*x])/(2*
d)

Rule 206

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTanh[(Rt[-b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[-b, 2]), x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 385

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> -Simp[((b*c - a*d)*x*(a + b*x^n)^(p +
 1))/(a*b*n*(p + 1)), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(a*b*n*(p + 1)), Int[(a + b*x^n)^(p + 1), x], x] /
; FreeQ[{a, b, c, d, n, p}, x] && NeQ[b*c - a*d, 0] && (LtQ[p, -1] || ILtQ[1/n + p, 0])

Rule 390

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Int[PolynomialDivide[(a + b*x^n)
^p, (c + d*x^n)^(-q), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && IGtQ[p, 0] && ILt
Q[q, 0] && GeQ[p, -q]

Rule 3676

Int[sec[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^(n_))^(p_.), x_Symbol] :> With[{ff = F
reeFactors[Sin[e + f*x], x]}, Dist[ff/f, Subst[Int[ExpandToSum[b*(ff*x)^n + a*(1 - ff^2*x^2)^(n/2), x]^p/(1 -
ff^2*x^2)^((m + n*p + 1)/2), x], x, Sin[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x] && IntegerQ[(m - 1)/2] &&
IntegerQ[n/2] && IntegerQ[p]

Rubi steps

\begin {align*} \int \cos (c+d x) \left (a+b \tan ^2(c+d x)\right )^2 \, dx &=\frac {\operatorname {Subst}\left (\int \frac {\left (a-(a-b) x^2\right )^2}{\left (1-x^2\right )^2} \, dx,x,\sin (c+d x)\right )}{d}\\ &=\frac {\operatorname {Subst}\left (\int \left ((a-b)^2+\frac {(2 a-b) b-2 (a-b) b x^2}{\left (1-x^2\right )^2}\right ) \, dx,x,\sin (c+d x)\right )}{d}\\ &=\frac {(a-b)^2 \sin (c+d x)}{d}+\frac {\operatorname {Subst}\left (\int \frac {(2 a-b) b-2 (a-b) b x^2}{\left (1-x^2\right )^2} \, dx,x,\sin (c+d x)\right )}{d}\\ &=\frac {(a-b)^2 \sin (c+d x)}{d}+\frac {b^2 \sec (c+d x) \tan (c+d x)}{2 d}+\frac {((4 a-3 b) b) \operatorname {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\sin (c+d x)\right )}{2 d}\\ &=\frac {(4 a-3 b) b \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {(a-b)^2 \sin (c+d x)}{d}+\frac {b^2 \sec (c+d x) \tan (c+d x)}{2 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.46, size = 66, normalized size = 1.06 \[ \frac {\tan (c+d x) \sec (c+d x) \left (a^2+(a-b)^2 \cos (2 (c+d x))-2 a b+2 b^2\right )+b (4 a-3 b) \tanh ^{-1}(\sin (c+d x))}{2 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]*(a + b*Tan[c + d*x]^2)^2,x]

[Out]

((4*a - 3*b)*b*ArcTanh[Sin[c + d*x]] + (a^2 - 2*a*b + 2*b^2 + (a - b)^2*Cos[2*(c + d*x)])*Sec[c + d*x]*Tan[c +
 d*x])/(2*d)

________________________________________________________________________________________

fricas [A]  time = 0.47, size = 106, normalized size = 1.71 \[ \frac {{\left (4 \, a b - 3 \, b^{2}\right )} \cos \left (d x + c\right )^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (4 \, a b - 3 \, b^{2}\right )} \cos \left (d x + c\right )^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (2 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{2} + b^{2}\right )} \sin \left (d x + c\right )}{4 \, d \cos \left (d x + c\right )^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c)^2)^2,x, algorithm="fricas")

[Out]

1/4*((4*a*b - 3*b^2)*cos(d*x + c)^2*log(sin(d*x + c) + 1) - (4*a*b - 3*b^2)*cos(d*x + c)^2*log(-sin(d*x + c) +
 1) + 2*(2*(a^2 - 2*a*b + b^2)*cos(d*x + c)^2 + b^2)*sin(d*x + c))/(d*cos(d*x + c)^2)

________________________________________________________________________________________

giac [A]  time = 2.60, size = 104, normalized size = 1.68 \[ \frac {4 \, a^{2} \sin \left (d x + c\right ) - 8 \, a b \sin \left (d x + c\right ) + 4 \, b^{2} \sin \left (d x + c\right ) + {\left (4 \, a b - 3 \, b^{2}\right )} \log \left ({\left | \sin \left (d x + c\right ) + 1 \right |}\right ) - {\left (4 \, a b - 3 \, b^{2}\right )} \log \left ({\left | \sin \left (d x + c\right ) - 1 \right |}\right ) - \frac {2 \, b^{2} \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1}}{4 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c)^2)^2,x, algorithm="giac")

[Out]

1/4*(4*a^2*sin(d*x + c) - 8*a*b*sin(d*x + c) + 4*b^2*sin(d*x + c) + (4*a*b - 3*b^2)*log(abs(sin(d*x + c) + 1))
 - (4*a*b - 3*b^2)*log(abs(sin(d*x + c) - 1)) - 2*b^2*sin(d*x + c)/(sin(d*x + c)^2 - 1))/d

________________________________________________________________________________________

maple [B]  time = 0.40, size = 125, normalized size = 2.02 \[ \frac {b^{2} \left (\sin ^{5}\left (d x +c \right )\right )}{2 d \cos \left (d x +c \right )^{2}}+\frac {b^{2} \left (\sin ^{3}\left (d x +c \right )\right )}{2 d}+\frac {3 b^{2} \sin \left (d x +c \right )}{2 d}-\frac {3 b^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2 d}-\frac {2 a b \sin \left (d x +c \right )}{d}+\frac {2 a b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}+\frac {a^{2} \sin \left (d x +c \right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)*(a+b*tan(d*x+c)^2)^2,x)

[Out]

1/2/d*b^2*sin(d*x+c)^5/cos(d*x+c)^2+1/2/d*b^2*sin(d*x+c)^3+3/2/d*b^2*sin(d*x+c)-3/2/d*b^2*ln(sec(d*x+c)+tan(d*
x+c))-2*a*b*sin(d*x+c)/d+2/d*a*b*ln(sec(d*x+c)+tan(d*x+c))+a^2*sin(d*x+c)/d

________________________________________________________________________________________

maxima [A]  time = 0.47, size = 105, normalized size = 1.69 \[ -\frac {b^{2} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} + 3 \, \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, \log \left (\sin \left (d x + c\right ) - 1\right ) - 4 \, \sin \left (d x + c\right )\right )} - 4 \, a b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right ) - 2 \, \sin \left (d x + c\right )\right )} - 4 \, a^{2} \sin \left (d x + c\right )}{4 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c)^2)^2,x, algorithm="maxima")

[Out]

-1/4*(b^2*(2*sin(d*x + c)/(sin(d*x + c)^2 - 1) + 3*log(sin(d*x + c) + 1) - 3*log(sin(d*x + c) - 1) - 4*sin(d*x
 + c)) - 4*a*b*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1) - 2*sin(d*x + c)) - 4*a^2*sin(d*x + c))/d

________________________________________________________________________________________

mupad [B]  time = 14.31, size = 148, normalized size = 2.39 \[ \frac {b\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (4\,a-3\,b\right )}{d}-\frac {\left (2\,a^2-4\,a\,b+3\,b^2\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\left (-4\,a^2+8\,a\,b-2\,b^2\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (2\,a^2-4\,a\,b+3\,b^2\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)*(a + b*tan(c + d*x)^2)^2,x)

[Out]

(b*atanh(tan(c/2 + (d*x)/2))*(4*a - 3*b))/d - (tan(c/2 + (d*x)/2)^5*(2*a^2 - 4*a*b + 3*b^2) - tan(c/2 + (d*x)/
2)^3*(4*a^2 - 8*a*b + 2*b^2) + tan(c/2 + (d*x)/2)*(2*a^2 - 4*a*b + 3*b^2))/(d*(tan(c/2 + (d*x)/2)^2 + tan(c/2
+ (d*x)/2)^4 - tan(c/2 + (d*x)/2)^6 - 1))

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (a + b \tan ^{2}{\left (c + d x \right )}\right )^{2} \cos {\left (c + d x \right )}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c)**2)**2,x)

[Out]

Integral((a + b*tan(c + d*x)**2)**2*cos(c + d*x), x)

________________________________________________________________________________________